$.ecp.nameSpace("com.ygsoft.ecp.printBlank");

com.ygsoft.ecp.printBlank.controller = $.ecp.Class(
		com.ygsoft.ecp.services.pagecontroller, {
			initPage : function() {
				var opt = $.ecp.utils.getArgument("printOpt");
				if (opt) {
					var options = $.parseJSON(opt);
					var callback = function() {
						document.cookie = "hideprint=1;path=/";
					};
					if(options.webversion){
						$("body").attr("webversion",options.webversion);
					}
					options.callback = callback;
					var print = options.preview ? "Preview" : "print";
					$.ecp.Document.print(print, null , options, callback);
					$("body").on("click", function() {
						var $el = $(this);
						if ($el.attr("id") == "btn_cancel") {
							document.cookie = "hideprint=1;path=/";
						}
					});
				}
			}
		});

$.ecp.thisWindow.onLoad(function(win) {
	var controller = new com.ygsoft.ecp.printBlank.controller(win);
	controller.initPage();
});